﻿@{
    Layout = null;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>@(ViewBag.SiteName)管理平台登录</title>
        <script src="@Url.Content("~/Scripts/jquery-1.7.2.min.js")" type="text/javascript"></script>
        <style type="text/css">
            *{ margin:0; padding:0;}
            body{ background:#e9e9e9 url(@Url.Content("~/Administrator/Content/v2/images/bg.jpg")) no-repeat center top}
            .box{ width:1000px; margin:0 auto; font-family:微软雅黑; font-size:12px; color:#535353;}
            .lwbox{ margin:294px 0 0 312px; width:546px;}
            .inputTxt{ border:1px solid #b5b5b5; width:160px; height:18px; line-height:18px; padding:0 5px;}
            .login{ background:url(@Url.Content("~/Administrator/Content/v2/images/login.gif")) no-repeat; width:62px; height:24px; border:none; cursor:pointer;}
        </style>
    </head>
    <body style="height: auto; overflow-y: hidden;">
        <div class="box">
            <div class="lwbox">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td height="36">&nbsp;</td>
                        <td>&nbsp;</td>
                        <td><img src="@Url.Content("~/Administrator/Content/v2/images/tit.gif")" /></td>
                    </tr>
                    <tr>
                        <td valign="top" style="padding-top:5px;"><img src="@Url.Content("~/Administrator/Content/v2/images/logo.gif")" /></td>
                        <td valign="top" style="padding-top:5px;" width="36" align="center"><img src="@Url.Content("~/Administrator/Content/v2/images/line.gif")" /></td>
                        <td valign="top">
                            <table width="100%" border="0" cellspacing="5" cellpadding="0">
                                <tr>
                                    <td>用户名：</td>
                                    <td> <input class="inputTxt" name="txtusername" type="text"/></td>
                                </tr>
                                <tr>
                                    <td>密&nbsp;&nbsp;码：</td>
                                    <td><input class="inputTxt" name="txtpassword" type="password" /></td>
                                </tr>
                                <tr>
                                    <td>验证码：</td>
                                    <td><input class="inputTxt" style="width:80px;" maxlength="4" name="txtsafecode" type="text" />&nbsp;<img id="safecodeimg" src="@Url.Content("~/Security/SafeCode")" alt="看不清楚，换一张"  style=" cursor:pointer" /></td>
                                </tr>
                                <tr>
                                    <td>&nbsp;</td>
                                    <td><input class="login" name="" type="button"  onclick="submitform();" /></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </body>
</html>

<script type="text/javascript">
                function submitform() {
                    var username = $.trim($("[name='txtusername']").val());
                    var password = $.trim($("[name='txtpassword']").val());
                    var safecode = $.trim($("[name='txtsafecode']").val());
                    if (username == "") {
                        alert("请填写用户名");
                        $("[name='txtusername']").focus();
                        return;
                    }
                    if (password == "") {
                        alert("请填写密码");
                        $("[name='txtpassword']").focus();
                        return;
                    }
                    if (safecode == "") {
                        alert("请填写验证码");
                        $("[name='txtsafecode']").focus();
                        return;
                    }
                    var data = { username: username, password: password, safecode: safecode };
                    var option={
                        url:"@Url.Action("Index")",
                        data:data,
                        type:"POST",
                        dataType:"json",
                        success:function(json){
                            if (!json.success) {
                                alert(json.errmsg);
                                $("#safecodeimg").click();
                                return;
                            }else{
                                location.href = "@Url.Action("index", "home")";
                            }
                        }
                    };
                    $.ajax(option);
                }

                $(function () { 
                    $("#safecodeimg").click(function() {
                        var src = "@Url.RouteUrl("WebUtils_SafeCode")";
                        $(this).attr("src", src+"?rnd="+new Date().getTime());
                    });
                });
</script>
            